package com.interest.controller.builder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by yangfeng on 16-11-10.
 */
public class ListModelAndViewBuilder extends ModelAndViewBuilder {
    private static final String MAP_KEY = "list";

    private final String viewName;
    private final List list;

    public ListModelAndViewBuilder(String name, List list) {
        this.viewName = name;
        this.list = list;
    }
    @Override
    protected Map<String, ?> getDataMap() {
        HashMap<String, Object> map = new HashMap<>();
        map.put(MAP_KEY, list);
        return map;
    }

    @Override
    protected String getViewName() {
        return viewName;
    }
}
